package de.lusiardi.webdav.xml;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * http://www.webdav.org/specs/rfc4918.html#ELEMENT_propertyupdate
 *
 * @author Joachim Lusiardi
 */
@XmlRootElement(name = "propertyupdate")
@XmlAccessorType(value = XmlAccessType.FIELD)
public class PropertyUpdate {

    @XmlElements(value = {
        @XmlElement(name = "remove", type = Remove.class),
        @XmlElement(name = "set", type = Set.class)})
    private List<AlternativeRemoveSet> removeOrSets;

    public List<AlternativeRemoveSet> getRemoveOrSets() {
        return removeOrSets;
    }

    public void setRemoveOrSets(List<AlternativeRemoveSet> removeOrSets) {
        this.removeOrSets = removeOrSets;
    }

    public void addRemoveOrSet(AlternativeRemoveSet ars) {
        if (removeOrSets == null) {
            removeOrSets = new ArrayList<AlternativeRemoveSet>();
        }
        removeOrSets.add(ars);
    }
}
